//
//  TYNavgator.m
//  CaiMi
//
//  Created by 冯贺 on 2017/12/13.
//  Copyright © 2017年 冯贺. All rights reserved.
//

#import "TYNavgator.h"

@interface TYNavgator()
@property(nonatomic,strong)UILabel * titileLabel;
@property(nonatomic,strong)UILabel * lineLabel;
@end

@implementation TYNavgator

- (void)setLeftTItle:(NSString *)leftTItle{
    _leftTItle = leftTItle;
    [self.leftBtn setTitle:leftTItle forState:UIControlStateNormal];
}

- (void)setMiddleTItle:(NSString *)middleTItle{
    _middleTItle = middleTItle;
    self.titileLabel.text = middleTItle;
}

- (void)setRightTItle:(NSString *)rightTItle{
    _rightTItle = rightTItle;
}
-(void)setRightImageName:(NSString *)rightImageName
{
    _rightImageName = rightImageName;
    [self.rightBtn setImage:[UIImage imageNamed:rightImageName] forState:UIControlStateNormal];
}
-(void)setLeftImageName:(NSString *)leftImageName{
    _leftImageName = leftImageName;
    [self.leftBtn setImage:[UIImage imageNamed:leftImageName] forState:UIControlStateNormal];
}

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = kBlueColor;
        
        self.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_leftBtn setImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
        _leftBtn.frame = CGRectMake(0, 0, 40, 40);
        _leftBtn.center = CGPointMake(20, navHeight-22);
        [self addSubview:self.leftBtn];
        
        _titileLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 18*bili)];
        _titileLabel.center = CGPointMake(SCREEN_WIDTH/2, navHeight-22);
        _titileLabel.textAlignment = 1;
        _titileLabel.textColor = [UIColor whiteColor];
        _titileLabel.font = [UIFont systemFontOfSize:16];
        [self addSubview:_titileLabel];

        self.lineLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, navHeight-1, SCREEN_WIDTH, 1)];
        _lineLabel.backgroundColor = RGB(236, 239, 242);
        [self addSubview:_lineLabel];
        
    }
    
    return self;
}

@end
